import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/index.vue'
import Kind from '../views/kind/index.vue'
import Cart from '../views/cart/index.vue'
import My from '../views/my/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    components: {
      default: Home,
      footer: () => import(/* webpackChunkName: "home" */ '../components/footer.vue')
    }
  },
  {
    path: '/kind',
    name: 'kind',
    components: {
      default: Kind,
      footer: () => import(/* webpackChunkName: "home" */ '../components/footer.vue')
    }
  },
  {
    path: '/cart',
    name: 'cart',
    components: {
      default: Cart
    }
  },
  {
    path: '/my',
    name: 'my',
    components: {
      default: My,
      footer: () => import(/* webpackChunkName: "home" */ '../components/footer.vue')
    }
  },
  {
    path: '/brandList',
    name: 'brandList',
    components: {
      default: () => import(/* webpackChunkName: "brandList" */ '../views/brandList/index.vue')
    }
  },
  {
    path: '/login',
    name: 'login',
    components: {
      default: () => import(/* webpackChunkName: "login" */ '../views/login/index.vue')
    }
  },
  {
    path: '/register',
    name: 'register',
    components: {
      default: () => import(/* webpackChunkName: "register" */ '../views/register/index.vue')
    }
  },
  {
    path: '/detail/:id',
    name: 'detail',
    components: {
      default: () => import(/* webpackChunkName: "detail" */ '../views/detail/index.vue')
    },
    props: {
      default: true
    }
  },
  {
    path: '/order',
    name: 'order',
    components: {
      default: () => import(/* webpackChunkName: "order" */ '../views/order/index.vue')
    }
  },
  {
    path: '/orderDetail/:id',
    name: 'orderDetail',
    components: {
      default: () => import(/* webpackChunkName: "orderDetail" */ '../views/orderDetail/index.vue')
    },
    props: {
      default: true
    }
  },
  {
    path: '/search',
    name: 'search',
    components: {
      default: () => import(/* webpackChunkName: "search" */ '../views/search/index.vue')
    }
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
